﻿#pragma once

//! 预编译头文件

#ifndef VF_PCH_H
#define VF_PCH_H

#ifndef STRICT
#define STRICT
#endif
// #define _CRTDBG_MAP_ALLOC
// #include <stdlib.h>
// #include <crtdbg.h>

// clang-format off
#define _ATL_APARTMENT_THREADED

#define _ATL_NO_AUTOMATIC_NAMESPACE

#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
#define _WIN32_WINNT _WIN32_WINNT_WIN10
#include <afxwin.h>
#include <afxext.h>
#include <afxole.h>
#include <afxodlgs.h>
#include <afxrich.h>
#include <afxhtml.h>
#include <afxcview.h>
#include <afxwinappex.h>
#include <afxframewndex.h>
#include <afxmdiframewndex.h>

#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdisp.h> // MFC 自动化类
#endif               // _AFX_NO_OLE_SUPPORT

#include <comsvcs.h>

#define ATL_NO_ASSERT_ON_DESTROY_NONEXISTENT_WINDOW

#include <atlbase.h>
#include <atlcom.h>
#include <atlctl.h>

// 新增
#include <initguid.h>
#include <tgcatids.h>
#include <atlsafe.h>
// clang-format off
#import <constant.tlb>
#import <framewrk.tlb> exclude ("UINT_PTR", "LONG_PTR") rename ("GetOpenFileName", "SEGetOpenFileName")
#import <fwksupp.tlb>
#import <geometry.tlb>
#import <part.tlb>
#import <assembly.tlb>
#import <draft.tlb>
#include <constant.tlh>
#include <framewrk.tlh>
#include <fwksupp.tlh>
#include <geometry.tlh>
#include <part.tlh>
#include <assembly.tlh>
#include <draft.tlh>

#include <afxstr.h>
#include <cassert>
#include <iostream>
#include <chrono>
#include <thread>
#include <comdef.h>
#include <windows.h>
#include <combaseapi.h>
#include <boost/log/utility/setup.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/sinks.hpp>
#include <boost/log/expressions.hpp>
#include <boost/log/sinks/text_file_backend.hpp>
#include <boost/log/utility/setup/file.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
#include <boost/log/sources/severity_logger.hpp>
#include <boost/log/sources/record_ostream.hpp>
#include <boost/smart_ptr/shared_ptr.hpp>
#include <boost/smart_ptr/make_shared_object.hpp>
#include <boost/log/core.hpp>
#include <boost/log/sinks/sync_frontend.hpp>
#include <boost/log/sinks/text_ostream_backend.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/log/support/date_time.hpp>
#include <unordered_set>
#include <map>
#include <set>
#include <Eigen/Core>
#include <Eigen/Eigen>
#include <rapidjson/document.h>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/writer.h>
#include <boost/algorithm/string.hpp>
#include <math.h>
#include <array>
#include <corecrt_math_defines.h>
#include <fstream>
#include <filesystem>

// 命名空间简化
namespace VFAdapter {
namespace pt = SolidEdgePart;
namespace fw = SolidEdgeFramework;
namespace as = SolidEdgeAssembly;
namespace dft = SolidEdgeDraft;
namespace cs = SolidEdgeConstants;
namespace gm = SolidEdgeGeometry;
namespace fwp = SolidEdgeFrameworkSupport;
extern fw::ApplicationPtr SEAPP;
} // namespace xd

// 公制下常量
constexpr double DM_TO_COORD = 0.1;
constexpr double CM_TO_COORD = 0.01;
constexpr double MM_TO_COORD = 0.001;
constexpr double COORD_TO_MM = 1000.0;

#define C_RELEASE(x)                                                           \
  if (NULL != x) {                                                             \
    x->Release();                                                              \
    x = NULL;                                                                  \
  }

#define VF_BOOST_LOG_TRIVAL_LINE BOOST_LOG_TRIVIAL(error) << __func__ << " ,  " << __LINE__
#endif